#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Time   : 2021/7/25 19:45
# @Author : cjw
from datetime import datetime
from typing import Optional

from pydantic import BaseModel, HttpUrl


class NewsBase(BaseModel):
    title: str
    img_url: HttpUrl
    content: str
    news_type: Optional[str] = '百家'
    is_valid: Optional[bool] = True
    is_top: Optional[bool] = False


class NewsCreate(NewsBase):
    create_at: Optional[datetime] = datetime.now()


class NewsUpdate(NewsBase):
    update_at: Optional[datetime] = datetime.now()
